package wifiunion.com.notice.fragment;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.widget.LinearLayoutManager;
import android.text.TextUtils;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.aspsine.irecyclerview.IRecyclerView;
import com.aspsine.irecyclerview.OnLoadMoreListener;
import com.aspsine.irecyclerview.OnRefreshListener;
import com.bumptech.glide.Glide;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;

import org.json.JSONException;
import org.json.JSONObject;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

import wifiunion.com.notice.BaseFragment;
import wifiunion.com.notice.BasePresenter;
import wifiunion.com.notice.Constants;
import wifiunion.com.notice.DateTimePickDialogUtil;
import wifiunion.com.notice.NoticeRecordContact;
import wifiunion.com.notice.R;
import wifiunion.com.notice.StatisticsContact;
import wifiunion.com.notice.adapter.NoticeRecordAdapter;
import wifiunion.com.notice.entity.DeviceLocation;
import wifiunion.com.notice.entity.NoticeInfoList;
import wifiunion.com.notice.entity.NoticeRecord;
import wifiunion.com.notice.presenter.GetNoticeSendcountPresenter;
import wifiunion.com.notice.presenter.NoticeRecordForTZDXPresenter;
import wifiunion.com.notice.presenter.NoticeRecordPresenter;
import wifiunion.com.notice.utils.SharedPreferencesUtils;
import wifiunion.com.notice.utils.glideutils.GlideCircleTransform;
import wifiunion.com.notice.widget.DeviceSelectSthDialog;
import wifiunion.com.notice.widget.LoadMoreFooterView;
import wifiunion.com.notice.widget.TipsDialog;

/**
 * Created by Administrator on 2016/11/29.
 * 触发记录
 */

public class NoticeRecordFragment extends BaseFragment implements View.OnClickListener,NoticeRecordContact.View, StatisticsContact.View, StatisticsContact.Callback, OnLoadMoreListener, OnRefreshListener {

    private TextView mTitleTv, mExchangeTv, mAddDeviceTv;


    private IRecyclerView mRecyclerView;

    private View mMainView;


    /**
     * 第一排相关textview
     */
    private TextView mLocationNametv, mStatisticsTitle1tv, mStatisticsContent1tv, mStatisticsTitle2tv, mStatisticsContent2tv;

    /**
     * 抓拍textview
     */
    private TextView /*mCaptureDeviceTv, */mLocContentTv;

    private TextView mCaptureDateTitleTv;
    /**
     * 搜索相关tv
     */
    private EditText mSearchEdt;
    private Button mSearchBtn;


    /**
     * 日期相关tv
     */
    private TextView mStartDateEt, mEndDateEt;


//    private String mStartDate = "", mEndDate = "";


    /**
     * 筛选相关
     */
    private LinearLayout mStatisticsLl1, mSubHeaderFilterLayout1, mSubHeaderFilterLayout2;

//    private TextView mSubHeaderFilterTitle1Tv, mSubHeaderFilterContent1Tv;


    private String mCaptureDeviceUuid = "";


    private NoticeRecordAdapter mAdapter;

    /**
     * 识别记录列表
     */
    private List<NoticeRecord> mData = new ArrayList<NoticeRecord>();




    private NoticeRecordContact.Presenter mPresenter;


    private GetNoticeSendcountPresenter mGetNoticeSendcountPresenter;


    private int mPageNum = 1;


    private HashMap<String, Object> mParams = new HashMap<>();


    private LoadMoreFooterView mLoadMoreFooterView;




    private String mAuthtoken;


    private DeviceSelectSthDialog mselectDialog;

    private ImageView headerIv;
    private TextView statustics1st1tv;
    private TextView statustics1st2tv;
    private TextView statustics1st3tv;
    private TextView statustics1st4tv;

    //查看状态下
    private NoticeInfoList noticeInfo;

    private ImageView backIv;

    private LinearLayout singleHeadll;
    private RelativeLayout doubleHeadll;
    private RelativeLayout threeHeadll;
    private ImageView singleheaderIv;
    private ImageView doubleheader1Iv;
    private ImageView doubleheader2Iv;
    private ImageView threeheader1Iv;
    private ImageView threeheader2Iv;
    private ImageView threeheader3Iv;

    private NoticeRecordForTZDXPresenter mNoticeRecordForTZDXPresenter;

    /**
     * 分组对话框回调结果
     */
//    private DeviceDialogCallBack mCaptureDeviceCallback = new DeviceDialogCallBack() {
//        @Override
//        public void updateList(ArrayList<DeviceSelectSth> data) {
//
//            int position = -1;
//
//            for (int i = 0; i < data.size(); i++) {
//                if (data.get(i).isSelected()) {
//                    position = i;
//                }
//            }
//
//            try {
//
//                mCaptureDeviceUuid = position == 0 ? "" : mDeviceList.get(position).getUuid();
//
//                mSubHeaderFilterContent1Tv.setText(position == 0 ? "不限" : mDeviceList.get(position).getLocationName());
//            } catch (Exception e) {
//                mCaptureDeviceUuid = "";
//
//                mSubHeaderFilterContent1Tv.setText("不限");
//            }
//        }
//    };


    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {

        mMainView = inflater.inflate(R.layout.fragment_noticerecord, container, false);
        mAuthtoken = SharedPreferencesUtils.getSharedPreferences(Constants.CONFIG_AUTHTOKEN, getContext());
        mNoticeRecordForTZDXPresenter = new NoticeRecordForTZDXPresenter(getContext(),this);
        Bundle  bundle = getArguments();
        if(null !=bundle)
        {
            noticeInfo  = (NoticeInfoList) bundle.getSerializable("notice");
        }

        initview();
        return mMainView;
    }

    @Override
    public void onActivityCreated(@Nullable Bundle savedInstanceState) {
        super.onActivityCreated(savedInstanceState);
        initData();
    }

    @Override
    public void initview() {

        //标题相关
        mTitleTv = (TextView) mMainView.findViewById(R.id.header_title_tv);
        mTitleTv.setText("触发记录");
        mExchangeTv = (TextView) mMainView.findViewById(R.id.header_exchange_tv);
        mExchangeTv.setVisibility(View.GONE);
        mAddDeviceTv = (TextView) mMainView.findViewById(R.id.header_add_tv);
        mAddDeviceTv.setVisibility(View.GONE);

        //第一行状态相关
//        mStatisticsLl1 = (LinearLayout) mMainView.findViewById(R.id.statustics_1st1_mainlayout);
//        mStatisticsLl1.setVisibility(View.VISIBLE);
//        mLocationNametv = (TextView) mMainView.findViewById(R.id.statiscs_locationname_tv);
//        mLocationNametv.setVisibility(View.GONE);
//        mStatisticsTitle1tv = (TextView) mMainView.findViewById(R.id.statustics_2nd_title_tv);
        mStatisticsContent1tv = (TextView) mMainView.findViewById(R.id.statustics_2nd_tv);
//        mStatisticsTitle2tv = (TextView) mMainView.findViewById(R.id.statustics_3rd_title_tv);
        mStatisticsContent2tv = (TextView) mMainView.findViewById(R.id.statustics_3rd_tv);
//
//        headerIv = (ImageView) mMainView.findViewById(R.id.statustics_1st_header_iv);
//        statustics1st1tv = (TextView) mMainView.findViewById(R.id.statustics_1st1_tv);
//        statustics1st2tv = (TextView) mMainView.findViewById(R.id.statustics_1st2_tv);
//        statustics1st3tv = (TextView) mMainView.findViewById(R.id.statustics_1st3_tv);
//        statustics1st4tv = (TextView) mMainView.findViewById(R.id.statustics_1st4_tv);



         singleHeadll = (LinearLayout) mMainView.findViewById(R.id.single_head_ll);
        doubleHeadll = (RelativeLayout) mMainView.findViewById(R.id.double_head_ll);
        threeHeadll = (RelativeLayout) mMainView.findViewById(R.id.three_head_ll);
        singleheaderIv = (ImageView) mMainView.findViewById(R.id.grid_item_singleheader_iv);
        doubleheader1Iv = (ImageView) mMainView.findViewById(R.id.grid_item_doubleheader1_iv);
        doubleheader2Iv = (ImageView) mMainView.findViewById(R.id.grid_item_doubleheader2_iv);
        threeheader1Iv = (ImageView) mMainView.findViewById(R.id.grid_item_threeheader1_iv);
        threeheader2Iv = (ImageView) mMainView.findViewById(R.id.grid_item_threeheader2_iv);
        threeheader3Iv = (ImageView) mMainView.findViewById(R.id.grid_item_threeheader3_iv);

        if(noticeInfo.getFromUser().size() ==1)
        {

            singleHeadll.setVisibility(View.VISIBLE);
            doubleHeadll.setVisibility(View.GONE);
            threeHeadll.setVisibility(View.GONE);

            if(!"0".equals(noticeInfo.getFromUser().get(0).getUuid()))
            {
                Glide.with(getContext())
                        .load(Constants.HTTP_URL_IMAGESERVER + noticeInfo.getFromUser().get(0).getComparisonPic())
                        .placeholder(R.drawable.mr_head).error(R.drawable.mr_head).fitCenter()
                        .transform(new GlideCircleTransform(getContext())).into(singleheaderIv);
            }
            else
            {
                // 陌生人
                Glide.with(getContext())
                        .load(R.drawable.msr)
                        .placeholder(R.drawable.msr).error(R.drawable.msr).fitCenter()
                        .transform(new GlideCircleTransform(getContext())).into(singleheaderIv);


            }

        }
        else if(noticeInfo.getFromUser().size() ==2)
        {

            singleHeadll.setVisibility(View.GONE);
            doubleHeadll.setVisibility(View.VISIBLE);
            threeHeadll.setVisibility(View.GONE);

            if(!"0".equals(noticeInfo.getFromUser().get(0).getUuid()))
            {
                Glide.with(getContext())
                        .load(Constants.HTTP_URL_IMAGESERVER + noticeInfo.getFromUser().get(0).getComparisonPic())
                        .placeholder(R.drawable.mr_head).error(R.drawable.mr_head).fitCenter()
                        .transform(new GlideCircleTransform(getContext())).into(doubleheader1Iv);
            }
            else
            {
                Glide.with(getContext())
                        .load(R.drawable.msr)
                        .placeholder(R.drawable.msr).error(R.drawable.msr).fitCenter()
                        .transform(new GlideCircleTransform(getContext())).into(doubleheader1Iv);
            }
            if(!"0".equals(noticeInfo.getFromUser().get(1).getUuid()))
            {
                Glide.with(getContext())
                        .load(Constants.HTTP_URL_IMAGESERVER + noticeInfo.getFromUser().get(1).getComparisonPic())
                        .placeholder(R.drawable.mr_head).error(R.drawable.mr_head).fitCenter()
                        .transform(new GlideCircleTransform(getContext())).into(doubleheader2Iv);
            }
            else
            {
                Glide.with(getContext())
                        .load(R.drawable.msr)
                        .placeholder(R.drawable.msr).error(R.drawable.msr).fitCenter()
                        .transform(new GlideCircleTransform(getContext())).into(doubleheader2Iv);
            }

        }else if(noticeInfo.getFromUser().size() >2)
        {

            singleHeadll.setVisibility(View.GONE);
            doubleHeadll.setVisibility(View.GONE);
            threeHeadll.setVisibility(View.VISIBLE);

            if(!"0".equals(noticeInfo.getFromUser().get(0).getUuid()))
            {
                Glide.with(getContext())
                        .load(Constants.HTTP_URL_IMAGESERVER + noticeInfo.getFromUser().get(0).getComparisonPic())
                        .placeholder(R.drawable.mr_head).error(R.drawable.mr_head).fitCenter()
                        .transform(new GlideCircleTransform(getContext())).into(threeheader1Iv);
            }
            else
            {
                Glide.with(getContext())
                        .load(R.drawable.msr)
                        .placeholder(R.drawable.msr).error(R.drawable.msr).fitCenter()
                        .transform(new GlideCircleTransform(getContext())).into(threeheader1Iv);

            }

            if(!"0".equals(noticeInfo.getFromUser().get(1).getUuid()))
            {
                Glide.with(getContext())
                        .load(Constants.HTTP_URL_IMAGESERVER + noticeInfo.getFromUser().get(1).getComparisonPic())
                        .placeholder(R.drawable.mr_head).error(R.drawable.mr_head).fitCenter()
                        .transform(new GlideCircleTransform(getContext())).into(threeheader2Iv);
            }
            else
            {
                Glide.with(getContext())
                        .load(R.drawable.msr)
                        .placeholder(R.drawable.msr).error(R.drawable.msr).fitCenter()
                        .transform(new GlideCircleTransform(getContext())).into(threeheader2Iv);
            }

            if(!"0".equals(noticeInfo.getFromUser().get(2).getUuid()))
            {
                Glide.with(getContext())
                        .load(Constants.HTTP_URL_IMAGESERVER + noticeInfo.getFromUser().get(2).getComparisonPic())
                        .placeholder(R.drawable.mr_head).error(R.drawable.mr_head).fitCenter()
                        .transform(new GlideCircleTransform(getContext())).into(threeheader3Iv);

            }
            else
            {
                Glide.with(getContext())
                        .load(R.drawable.msr)
                        .placeholder(R.drawable.msr).error(R.drawable.msr).fitCenter()
                        .transform(new GlideCircleTransform(getContext())).into(threeheader3Iv);
            }

        }

















//        statustics1st1tv.setText("姓名："+recordMember.getName());
//        statustics1st2tv.setText("性别："+(recordMember.getSex() == 1 ? "男":"女"));
//        statustics1st3tv.setText("手机："+recordMember.getPhone());
//        statustics1st4tv.setText("分组："+recordMember.getGroupName());


        //抓拍时间相关
        mCaptureDateTitleTv = (TextView) mMainView.findViewById(R.id.sub_header_date_title_tv);
        mCaptureDateTitleTv.setText("触发时间:");
        mStartDateEt = (TextView) mMainView.findViewById(R.id.startdate_tv);

        mEndDateEt = (TextView) mMainView.findViewById(R.id.enddate_tv);


        //筛选相关
//        mSubHeaderFilterLayout1 = (LinearLayout) mMainView.findViewById(R.id.sub_header_filter_layout1);
//        mSubHeaderFilterLayout1.setVisibility(View.GONE);
//        mSubHeaderFilterTitle1Tv = (TextView) mMainView.findViewById(R.id.sub_header_filter_title1_tv);
//        mSubHeaderFilterContent1Tv = (TextView) mMainView.findViewById(R.id.sub_header_filter_content1_tv);


//        mSubHeaderFilterTitle1Tv.setText("抓拍设备");
//        mSubHeaderFilterContent1Tv.setText("");

//        mSubHeaderFilterLayout2 = (LinearLayout) mMainView.findViewById(R.id.sub_header_filter_layout2);
//        mSubHeaderFilterLayout2.setVisibility(View.GONE);

        //关键字相关
        mSearchEdt = (EditText) mMainView.findViewById(R.id.search_edt);
        mSearchEdt.setHint("输入通知内容");
        mSearchBtn = (Button) mMainView.findViewById(R.id.search_btn);

        mRecyclerView = (IRecyclerView) mMainView.findViewById(R.id.device_irecyclerView);
        mAdapter = new NoticeRecordAdapter(this, getContext(), mData, itemClick);
        mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
        mRecyclerView.setIAdapter(mAdapter);

        mLoadMoreFooterView = (LoadMoreFooterView) mRecyclerView.getLoadMoreFooterView();


        mStartDateEt.setOnClickListener(this);
        mEndDateEt.setOnClickListener(this);
//        mSubHeaderFilterContent1Tv.setOnClickListener(this);

        mRecyclerView.setOnLoadMoreListener(this);
        mRecyclerView.setOnRefreshListener(this);
        mSearchBtn.setOnClickListener(this);
        backIv = (ImageView) mMainView.findViewById(R.id.addconsumer_back);
        backIv.setOnClickListener(this);

    }

    @Override
    public void initData() {
        mPresenter = new NoticeRecordPresenter(getContext(), this);
        getFilterData();
//        mGetNoticeTriggercountPresenter = new GetNoticeTriggercountPresenter(getContext(), this);
//        HashMap<String, Object> params = new HashMap<>();
//        params.put("Authorization", mAuthtoken);
//        params.put("memberUuid", "");
//        params.put("deviceUuid", "");
//        mGetNoticeTriggercountPresenter.start(params);

        mGetNoticeSendcountPresenter  = new GetNoticeSendcountPresenter(getContext(), this);
        HashMap<String, Object> params1 = new HashMap<>();
        params1.put("Authorization", mAuthtoken);
        params1.put("notificationUuid", noticeInfo.getUuid());
        mGetNoticeSendcountPresenter.start(params1);



    }

    @Override
    public void onClick(View v) {
        int i = v.getId();
        if (i == R.id.startdate_tv) {
            DateTimePickDialogUtil dateTimePicKDialog = new DateTimePickDialogUtil(
                    getActivity(), mStartDateEt.getText().toString());
            dateTimePicKDialog.dateTimePicKDialog(mStartDateEt);

        } else if (i == R.id.enddate_tv) {
            DateTimePickDialogUtil dateTimePicKDialog2 = new DateTimePickDialogUtil(
                    getActivity(), mEndDateEt.getText().toString());
            dateTimePicKDialog2.dateTimePicKDialog(mEndDateEt);

        } else if (i == R.id.search_btn) {//                mStartDate = TextUtils.isEmpty(mStartDateEt.getText().toString()) ? "" : mStartDateEt.getText().toString();
//                mEndDate = TextUtils.isEmpty(mEndDateEt.getText().toString()) ? "" : mEndDateEt.getText().toString();
            mPageNum = 1;

            mData.clear();
            mAdapter.notifyDataSetChanged();
            getFilterData();

        } else if (i == R.id.addconsumer_back) {
            NoticeListFragment noticeListFragment = (NoticeListFragment) getFragmentManager().findFragmentByTag("noticeListFragment");
            getFragmentManager().beginTransaction().hide(this).show(noticeListFragment).commit();


        }
    }

    @Override
    public void onServerFailed(Object errorObj) {

    }

    @Override
    public void onNetFailed() {

    }

    @Override
    public void onProgress() {

    }

    @Override
    public void onError(Object obj) {

    }

    @Override
    public void onSuccess(final Object obj) {

    }

    @Override
    public void onNoticeRecordSuccess(final Object obj) {

        if(null != getActivity())
        {


            JSONObject jsonObject = null;
            try {
                Gson gson = new Gson();
                jsonObject = new JSONObject((String) obj);
                String data = jsonObject.getString("data");
                Object result = gson.fromJson(data, new TypeToken<List<NoticeRecord>>() {
                }.getType());
                mData.addAll((List<NoticeRecord>) result);

                mAdapter.notifyDataSetChanged();
                mRecyclerView.setRefreshing(false);
                mLoadMoreFooterView.setStatus(LoadMoreFooterView.Status.GONE);


                JSONObject pageObj = (JSONObject) jsonObject.get("pages");
                long totalCount = pageObj.getLong("totalCount");
                mStatisticsContent1tv.setText(String.valueOf(totalCount) + "次");
            } catch (JSONException e) {
                e.printStackTrace();
            }
        }

    }

    @Override
    public void onNoticeTZDXSuccess(Object obj) {

        final String result = (String) obj;
        if(null != result)
        {

            if(null != getActivity())
            {

                final TipsDialog showDialog = new TipsDialog(getContext());
                showDialog.setTitleMsg("通知对象");
                showDialog.setMsgHint( result);
                showDialog.setCancelListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        showDialog.dismiss();
                    }
                });
                showDialog.setComfirmListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {


                        showDialog.dismiss();
                    }
                });

                showDialog.show();

            }

        }


    }

    @Override
    public void onImgUploadSuccess(String imgpath) {

    }

    @Override
    public void onAddDeviceSuccess() {

    }

    @Override
    public void onAddDeviceLocSuccess() {

    }

    @Override
    public void onGetDeviceLocListSuccess(Object obj) {

    }

    @Override
    public void onAddGroupSuccess() {

    }

    @Override
    public void onGetDeviceGroupListSuccess(Object obj) {

    }

    @Override
    public void onDeleteDeviceSuccess() {

    }

    @Override
    public void onEditDeviceSuccess() {

    }

    @Override
    public void onDeleteGroupSuccess() {

    }

    @Override
    public void onGetNoticeTriggerCountSuccess(final Object data) {
    }

    @Override
    public void onGetNoticeSendCountSuccess(final Object data) {

        if(null != getActivity())
        {


            mStatisticsContent2tv.setText(String.valueOf((Long) data)+"条");

        }

    }

    @Override
    public void onGetDeviceListSuccess(Object data) {

    }

    @Override
    public void setPresenter(BasePresenter tp) {

    }

    @Override
    public void onLoadMore() {
        if (mLoadMoreFooterView.canLoadMore() && mAdapter.getItemCount() > 0) {
            mLoadMoreFooterView.setStatus(LoadMoreFooterView.Status.LOADING);

//            mStartDate = TextUtils.isEmpty(mStartDateEt.getText().toString()) ? "" : mStartDateEt.getText().toString();
//            mEndDate = TextUtils.isEmpty(mEndDateEt.getText().toString()) ? "" : mEndDateEt.getText().toString();
            mPageNum += 1;

            getFilterData();

            mRecyclerView.setRefreshing(false);
        }
    }

    @Override
    public void onResume() {
        super.onResume();
        getView().setFocusableInTouchMode(true);
        getView().requestFocus();
        getView().setOnKeyListener(new View.OnKeyListener() {
            @Override
            public boolean onKey(View v, int keyCode, KeyEvent event) {
                if (event.getAction() == KeyEvent.ACTION_UP && keyCode == KeyEvent.KEYCODE_BACK){
                    NoticeListFragment  clf = (NoticeListFragment) getFragmentManager().findFragmentByTag("noticeListFragment");
                    getFragmentManager().beginTransaction().hide(NoticeRecordFragment.this).show(clf).commit();
                    return true;
                }
                return false;
            }
        });
    }


    @Override
    public void onRefresh() {
        mLoadMoreFooterView.setStatus(LoadMoreFooterView.Status.GONE);

        if(null != getActivity())
        {


            mData.clear();
            mAdapter.notifyDataSetChanged();

        }

        mPageNum = 1;
        getFilterData();

        mRecyclerView.setRefreshing(true);
    }


    View.OnClickListener itemClick = new View.OnClickListener() {


        @Override
        public void onClick(View v) {


            int i = v.getId();
            if (i == R.id.noticerecord_item_tzdx_tv) {
                int index = Integer.parseInt(String.valueOf(v.getTag()));
                NoticeRecord noticeRecord = mData.get(index);
                HashMap<String, Object> mtzdx = new HashMap<>();
                mtzdx.put("Authorization", mAuthtoken);
                mtzdx.put("uuid", noticeRecord.getUuid());
                mNoticeRecordForTZDXPresenter.start(mtzdx);


            } else if (i == R.id.noticerecord_item_tznr_tv) {
                int postion = Integer.parseInt(String.valueOf(v.getTag()));
                NoticeRecord record = mData.get(postion);
                if (null != record) {
                    final TipsDialog showDialog = new TipsDialog(getContext());
                    showDialog.setTitleMsg("通知内容");
                    showDialog.setMsgHint(record.getContent());
                    showDialog.setCancelListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View v) {
                            showDialog.dismiss();
                        }
                    });
                    showDialog.setComfirmListener(new View.OnClickListener() {
                        @Override
                        public void onClick(View v) {
                            showDialog.dismiss();
                        }
                    });

                    showDialog.show();
                }


            } else if (i == R.id.noticerecord_item_header_iv) {
//                Intent intent = new Intent(getActivity(), StatisticsCaptureProcessActivity.class);
//                int index1 = Integer.parseInt(String.valueOf(v.getTag(R.id.noticerecord_item_header_iv)));
//                NoticeRecord record1 = mData.get(index1);
//                intent.putExtra("noticedata", record1);
//                getContext().startActivity(intent);

            }
        }
    };

    private void getFilterData() {


        mParams.clear();
        mParams.put("Authorization", mAuthtoken);
        mParams.put("pageNum", String.valueOf(mPageNum));
        mParams.put("pageSize", String.valueOf(10));
        mParams.put("notificationUuid", noticeInfo.getUuid());

        if(!TextUtils.isEmpty(mStartDateEt.getText().toString()))
        {
            mParams.put("startDate", mStartDateEt.getText().toString());
        }
        if(!TextUtils.isEmpty(mEndDateEt.getText().toString()))
        {
            mParams.put("endDate", mEndDateEt.getText().toString());
        }
        if(!TextUtils.isEmpty(mSearchEdt.getEditableText().toString()))
        {
            mParams.put("condition", mSearchEdt.getEditableText().toString());

        }

        mPresenter.start(mParams);
    }
}